package com.example.bank.web;

import com.example.bank.application.TransferService;
import com.example.bank.common.Result;
import com.example.bank.exception.DailyLimitExceededException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
public class TransferController {

    @Autowired
    private TransferService transferService;

    @GetMapping("/transfer")
    public Result<Boolean> transfer(Long sourceUserId, String targetAccountNumber,
                                    BigDecimal targetAmount, String targetCurrency) throws Exception, DailyLimitExceededException {
        return transferService.transfer(sourceUserId,targetAccountNumber,targetAmount,targetAccountNumber) ;
    }

}
